/**
 * @param {number} n
 * @return {number}
 */
var fib = function (n) {
  if (n == 0) return 1
  if (n == 1 || n == 2) return n

  let count = 3
  let f1 = BigInt(1)
  let f2 = BigInt(2)
  while (count <= n) {
      f3 = f1 + f2
      f1 = f2;
      f2 = f3;
      count++
  }
  return f3 % BigInt(1e9 + 7)
};
console.log(fib(5))